<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理器材</title>
    <link rel="stylesheet" href="../../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layui-form-item">
        <label class="layui-form-label">id:</label>
        <div class="layui-input-inline">
            <input type="text" name="meid" placeholder="请输入" autocomplete="off" class="layui-input" id="meid" value="1">
        </div>
        <div class="layui-input-inline">
            <button type="submit" class="layui-btn layui-btn-primary" lay-submit  lay-filter="data-search-bbb"><i class="layui-icon"></i> 搜 索</button>
        </div>
    </div>
        <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm data-add-btn"> 添加器材 </button>
            <button class="layui-btn layui-btn-sm layui-btn-danger data-update-btn"> 修改器材 </button>
        </div>
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter">

            <script type="text/html" id="currentTableBar">
                <a class="layui-btn layui-btn-xs data-count-sel" lay-event="del">删除</a>
            </script>

        </table>
    </div>
</div>

<script src="../../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="../../../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    layui.use(['table', 'form', 'tableSelect'], function () {

        var $ = layui.jquery,
            table = layui.table,
            form = layui.form,
            tableSelect = layui.tableSelect;

    layui.use(['table', 'form'], function () {
        //开始使用

        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            layuimini = layui.layuimini;


        var userInfo = layui.data('userInfo');

        //加载信息
        table.render({
            elem: '#currentTableId',
            url: 'http://localhost:8080/equipment/findallequipment',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {field: 'meid', width: 80, title: 'ID'},
                {field: 'mename', width: 120, title: '器材名'},
                {field: 'metotal', width: 80, title: '器材总数'},
                {field: 'mealready', width: 120, title: '已使用器材数'},
                {field: 'meuse', width: 90, title: '可使用器材数'},
                {field: 'mefrom', width: 140, title: '器材来源'},
                {field: 'metype', width: 100, title: '器材类型'},
                {title: '操作', width: 150, templet: '#currentTableBar', fixed: "right", align: "center"}
            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true,

        });

    });


    // 监听搜索操作
    form.on('submit(data-search-bbb)', function (data) {
        var field = data.field;

        //执行搜索重载
        table.reload('currentTableId', {
            page: {
                curr: 1
            }
            , where: {
                meid: $('#meid').val(),
            }//这里传参  向后台
            , url: 'http://localhost:8080/equipment/get'
            , method: 'get'
        }, 'data');

        return false;
    });

    });
</script>
</body>
</html>